<?php

namespace App\AgentAdmin\Controllers;

use App\AgentAdmin\Metrics\Examples;
use App\AgentAdmin\Metrics\Orders;
use App\Http\Controllers\Controller;
use Dcat\Admin\Layout\Column;
use Dcat\Admin\Layout\Content;
use Dcat\Admin\Layout\Row;
use Dcat\Admin\Widgets\Alert;
use App\Models\Notice;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Widgets\Card;
use App\AgentAdmin\Metrics\Charts\OrderLIne;
use App\AgentAdmin\Metrics\Charts\VisitLIne;

class HomeController extends Controller
{
    public function index(Content $content)
    {
        return $content
            ->header('统计面板')
            // ->description('Description...')
            ->body( function (Row $row) {
                $row->column(12, function (Column $column) {
                    $column->row(function (Row $row) {
                        $notices = Notice::where(['type'=>1,'show'=>1])->get();
                        foreach($notices as $notice){
                            $alert = Alert::make('',$notice->content);
                            $alert->success();
                            $alert->removable();
                            $row->column(12,$alert->success());
                        }
                    });
                });
                $row->column(1, new Examples\Agent());
                $row->column(2, new Orders\DayOrderNumCount());
                $row->column(3, new Orders\DayOrderMoneyCount());
                $row->column(3, new Examples\NewOrders());
                $row->column(3, new Examples\Account());
                $row->column(6, function (Column $column) {
                    $column->row(Card::make('订单金额走势图', OrderLIne::make()));
                    
                });
                $row->column(6, function (Column $column) {
                    $column->row(Card::make('访客浏览量走势图', VisitLIne::make()));
                    
                });
            });
            
    }
}
